import request from '@/router/axios';
import {baseUrl} from '@/config/env';

export const getCountry = () => {
  return request({
    url: baseUrl + '/api/region/getCountry',
    method: 'get',
    params: {
      limit:0,
    }
  })
}

export const getBank = (page, limit, params) => {
  return request({
    url: baseUrl + '/api/bank/getpages',
    method: 'get',
    params: {
      key:params.bankName==undefined?'':params.bankName,
      page,
      limit,
    }
  })
}

export const getBankList = () => {
  return request({
    url: baseUrl + '/api/bank/getlist',
    method: 'get'
  })
}

export const getBranch = (page, limit, params) => {
  return request({
    url: baseUrl + '/api/bankBranch/getpages',
    method: 'get',
    params: {
      key:params.branchName==undefined?'':params.branchName,
      type:params.bankId==undefined?'':params.bankId,
      page,
      limit,
    }
  })
}

export const removeBank = (ids) => {
  return request({
    url: baseUrl + '/api/bank/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const addBank = (row) => {
  return request({
    url: baseUrl + '/api/bank/add',
    method: 'post',
    data: row
  })
}

export const updateBank = (row) => {
  return request({
    url: baseUrl + '/api/bank/edit',
    method: 'post',
    data: row
  })
}

export const removeBranch = (ids) => {
  return request({
    url: baseUrl + '/api/bankBranch/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const addBranch = (row) => {
  return request({
    url: baseUrl + '/api/bankBranch/add',
    method: 'post',
    data: row
  })
}

export const updateBranch = (row) => {
  return request({
    url: baseUrl + '/api/bankBranch/edit',
    method: 'post',
    data: row
  })
}